#include <iostream>

using namespace std;

//使用重载实现数组的排序
void Sort(int [], int len);
void Sort(float [], float len);
void Sort(double [], int len);
void Show(int [], int len);
void Show(float [], float len);
void Show(double [], double len);

int main(){
    int iNums[] = {56, 54, 12, 89, 43};
    float fNums[] = {78.0f, 5.7f, 42.8f, 99.1f};
    double dNums[] = {78.9, 23.6, 77.8, 98.5, 33.3};

    cout << "排序前：";
    Show(iNums, sizeof(iNums) / sizeof(iNums[0]));
    Sort(iNums, sizeof(iNums) / sizeof(iNums[0]));
    cout << "排序后：";
    Show(iNums, sizeof(iNums) / sizeof(iNums[0]));

    cout << "排序前：";
    Show(fNums, sizeof(fNums) / sizeof(fNums[0]));
    Sort(fNums, sizeof(fNums) / sizeof(fNums[0]));
    cout << "排序后：";
    Show(fNums, sizeof(fNums) / sizeof(fNums[0]));


}
void Sort(int nums[], int len){
    int temp;
    cout << "sizeof(nums) = " << sizeof(nums) << endl;
    for (int i = 0; i < len - 1; ++i) {
        for (int j = 0; j < len - i - 1; ++j) {
            if (nums[j] < nums[j + 1]){
                temp = nums[j];
                nums[j] = nums[j + 1];
                nums[j + 1] = temp;
            }
        }
    }
}
void Sort(float nums[], float len){
    cout << "sizeof(nums) = " << sizeof(nums) << endl;
    float temp;
    for (int i = 0; i < len - 1; ++i) {
        for (int j = 0; j < len - i - 1; ++j) {
            if (nums[j] < nums[j + 1]){
                temp = nums[j];
                nums[j] = nums[j + 1];
                nums[j + 1] = temp;
            }
        }
    }
}
void Sort(double nums[], double len){
    int temp;
    cout << "sizeof(nums) = " << sizeof(nums) << endl;
    for (int i = 0; i < len - 1; ++i) {
        for (int j = 0; j < len - i - 1; ++j) {
            if (nums[j] < nums[j + 1]){
                temp = nums[j];
                nums[j] = nums[j + 1];
                nums[j + 1] = temp;
            }
        }
    }
}
void Show(int nums[], int len){
    for (int i = 0; i < len; ++i) {
        cout << nums[i] << "，";
    }
    cout << endl;
}

void Show(float nums[], float len){
    for (int i = 0; i < len; ++i) {
        cout << nums[i] << "，";
    }
    cout << endl;
}


/*//默认参数
void sample(int = 10);
int main() {
    sample();
    return 0;
}*/
